<!--<?php
print <<<EOT
-->

<script src="css/edit.js"></script>
<script>
<!--
function addWishlist(id) {
    url = "wishlist_view.php?act=add&pid="+id;
    open(url,'wishlist_page');
}
function addCart(id) {
    var buy_num = $("#txtPNum"+id).val();
    
    if (!IsNumber(buy_num)) {
        alert('Please enter the order qty !');
        $("#txtPNum"+id).focus();
        return false;
    }
    else if(buy_num > parseInt(document.all('p_qty['+id_ary[i]+']').value)
    {
        alert('Item '+document.all('id_code['+id_ary[i]+']').value+': Order Qty should not be more than the Available Qty.');
        $("#txtPNum"+id).focus();
        return false;
    }
    else {
        url = "cart_view.php?act=add&inventorytype=0&inventoryid=0&pid="+id+"&js=1&addnum="+buy_num+"&fitemid="+fitemid;
        document.getElementById('addtocontentiframe').src=url;
    }
}
function validate(form) {
    var id_ary = $js_id_ary_str;
    var qty_flag = 0;
    
    for (var i=0; i<id_ary.length; i++) {
        
        if (parseInt(document.all('p_num['+id_ary[i]+']').value) > parseInt(document.all('p_qty['+id_ary[i]+']').value)) {
            alert('Item '+document.all('id_code['+id_ary[i]+']').value+': Order Qty should not be more than the Available Qty.');
            return false;
        }
        
        if (document.all('p_num['+id_ary[i]+']').value != '' && isDigit(document.all('p_num['+id_ary[i]+']').value) && parseInt(document.all('p_num['+id_ary[i]+']').value) > 0) {
            qty_flag = 1;            
        }
        

        
    }
    
    if (qty_flag == 0) {
        alert('Please enter the order qty !');
        return false;
    }
    return true;
}

//-->
</script>

            <div class="main_R">   
            <!--<div class="tb-top-logo">
           <img src="css/images/about_jansen_furniture.jpg" alt="" />
            </div> 
              <div class="right-pad"> --> 
                  <table width="745" border="0" cellspacing="0" cellpadding="0">                  
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>
                      <td bgcolor="FFFFFF" width="10"><img name="" src="./images/spacer.gif" width="10" height="10" alt=""></td>
                      <td bgcolor="FFFFFF" width="740">
                        <table width="740" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td align="center" class="pageTitleText">{$page_show['str']}</td>
                          </tr>
                          <tr>
                            <td align="center" class="pageListings">{$page_show['pagelink']}</td>
                          </tr>
                        </table>                        
                    <div><img name="" src="./images/spacer.gif" width="538" height="5" alt=""></div>
                      </td>
                      <td ></td>
                      <td ></td>
                      <td ></td>
                    </tr>
                    
                  </table>                
                  
                  <div><img name="" src="./images/spacer.gif" width="568" height="4" alt=""></div>                  
                  <iframe name='addtocontentiframe' width=0 height=0 src="about:blank" id='addtocontentiframe' style="visibility:hidden;"></iframe>
                  
                  <form action="cart_view.php" method="post" name="form1" onSubmit="return validate(this)" target="addtocontentiframe">
    	    	  <input type="hidden" name="act" value="adddate">
    	    	  <input type="hidden" name="inventorytype" value="$inventory_type">
    	    	  <input type="hidden" name="inventoryid" value="$inventoryid">
    	    	  <input type="hidden" name="intype" value="$inventoryid">
    	    	  <input type="hidden" name="js" value="1">
    	    	  
                  <table width="745" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"></td>
                      <td width="136"></td>
                      <td width="136"></td>
                      <td width="136"></td>
                      <td width="136"></td>
                      <td ></td>
                    </tr>
                    <tr>
                     <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>

               
<!--
EOT;
$index = 1;
$htmlTRFormat = '<tr><td height="18" width="70">%s</td><td width="5" align="center"></td><td>%s</td></tr>';
foreach ($product_ary as $k=>$v) {
    $str = '';    
    
    if ($index%4 == 0 && $index>3) {
        $str       = '<td width="4"><img name="" src="./images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td width="4"><img name="" src="./images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>';
        
    } else {
        $str = '';    
    }
    $start_limit_1 = $start_limit+$index;
    if (trim($v['small_pic']) == "" || !file_exists("./zh/attachments/" . $v['small_pic'])) {
        $v['small_pic'] = 'no.gif';
    }
    $price_show = '';
    if ($jansen_type==2) { //Container Customer
        $sp = isset($sp_ary[$v['id']]) ? $sp_ary[$v['id']] : 0;
        echo $sp;
        $sp = number_format($sp, 2, '.', ',');
        if ($sp == 0) {
            $sp_div = '';
            //$sp_div1 = '<div class="price">&nbsp;</div>';
             // $sp_div1 = sprintf($htmlTRFormat,' ',' ');   
              $sp_div1='';         
        } else {
            $sp = number_format($sp, 2, '.', ',');
            //$sp_div = '<div class="price">Special: ' . $sp . ' USD</div>';
            $sp_div = sprintf($htmlTRFormat,'Special',$sp.' USD');
            $sp_div1 = '';
        }
        $show_text = $sp==0 ? "Price" : "Regular";
        if ($inventory_type == 2) {
            //$sp = $sp==0 ? ' - ' : (float)$sp . '';
            $v['price_2'] = number_format($v['price_2'], 2, '.', ',');
            //$price_show = '<div class="price">' . $show_text . ': ' . $v['price_2'] . ' USD</div>
	        //               ' . $sp_div;
	        $price_show = sprintf($htmlTRFormat,$show_text,$v['price_2'].' USD').$sp_div;               
        } else {
            //$sp = $sp==0 ? ' - ' : (float)$sp . '';
            $v['price_1'] = number_format($v['price_1'], 2, '.', ',');
            //$price_show = '<div class="price">' . $show_text . ': ' . $v['price_1'] . ' USD</div>' . $sp_div;
            $price_show = sprintf($htmlTRFormat,$show_text,$v['price_1'].' USD').$sp_div;
        }
    	
    } elseif ($jansen_type == 1) {//Wholesale Customer
        $sp = isset($sp_ary2[$v['id']]) ? $sp_ary2[$v['id']] : 0;
        $sp = number_format($sp, 2, '.', ',');
        if ($sp == 0) {
            $sp_div = '';
            //$sp_div1 = '<div class="price">&nbsp;</div>';
            //$sp_div1 = sprintf($htmlTRFormat,'','&nbsp;');   
            $sp_div1='';
        } else {
            $sp = number_format($sp, 2, '.', ',');
            //$sp_div = '<div class="price">Special: ' . $sp . ' HKD</div>';
            $sp_div = sprintf($htmlTRFormat,'Special',$sp.' HKD');
            $sp_div1 = '';
        }
        $show_text = $sp==0 ? "Price" : "Regular";
        $v['price_3'] = number_format($v['price_3'], 2, '.', ',');
    	//$price_show = '<div class="price">' . $show_text . ': ' . $v['price_3'] . ' HKD</div>
	     //              ' . $sp_div;
	    $price_show = sprintf($htmlTRFormat,'HKD',$v['price_3']);               
    }
    
    $new_show = '';
    if ($v['new_flag'] == 1) {
        $new_show = '&nbsp;&nbsp;<span class="new_show">new!</span>';
    }
    
print <<<EOT
-->    	
 	              
<td align="center">
    	                <table width="160" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td bgcolor="FFFFFF" width="10"><img name="" src="./images/spacer.gif" width="10" height="10" alt=""></td>
                            <td bgcolor="FFFFFF" width="145"><img name="" src="./images/spacer.gif" width="115" height="10" alt=""></td>                            
                          </tr>
                          <tr valign=top>
                            <td bgcolor="FFFFFF" width="10"><img name="" src="./images/spacer.gif" width="10" height="10" alt=""></td>
                            <td bgcolor="FFFFFF" width="145"><div><a href="inventory_details.php?names={$names}&inventoryid=$inventoryid&categoryid=$categoryid&pid={$v['id']}&fid={$fid}{$special_flag}"><img src="./zh/attachments/{$v['small_pic']}" alt="Image of {$v['code']}" name="jf_product_images_sm_image_{$v['id']}" width="113" height="113" class="picture" id="Img1" border="0"></a></div>
                              <div><img src="./images/spacer.gif" width="115" height="5" alt=""></div>
                              <div align="left"><a href='inventory_details.php?names={$names}&inventoryid=$inventoryid&categoryid=$categoryid&pid={$v['id']}&fid={$fid}{$special_flag}'>{$v['code']}</a>  {$new_show}</div>
                              <div><img src="./images/spacer.gif" width="115" height="5" alt=""></div>
                             <div>
                              <table cellspacing="0" cellpadding="0">
                              <tbody>
                               $price_show
                               <tr>
                                      <td height="25" width="70">Available Qty</td>
                                      <td width="5" align="center"></td>
                                      <td>{$product_qty_ary[$v['id']]}</td>
                               </tr>
                                <tr><td height="25" width="35" >Finish</td>
                                    <td width="5" align="center"> </td>
                                    <td><select style="width: 42px;height:17px; padding:0; margin:0;" id='selFinish{$v["id"]}' name='selFinish{$v["id"]}'>{$_finish[$v["finish_id"]]}</select></td>
                               </tr>
                              <tr><td height="25">Order Qty</td>
                                      <td width="5" align="center"></td>
                                      <td><input class="form" name="p_num[{$v['id']}]" value="" style="width:42px;height:17px; padding:0; margin:0;" type="text" />
                                      <input type="hidden" name="p_qty[{$v['id']}]" value="{$product_qty_ary[$v['id']]}">
                              <input type="hidden" name="id_code[{$v['id']}]" value="{$v['code']}"></td>
                               </tr>  
                               $sp_div1
                               <tr>
                                  <td height="25" colspan="3">
                                  <div class="addtocart" >
								  <a href="javascript:;" onclick="addCart({$v['id']});">Add to Basket</a>
                                 </div>
								 </td>
                              </tr>
                              </tbody></table>
                                </div>                            
                            </td>                            
                          </tr>
                          <tr>
                            <td bgcolor="FFFFFF" width="10"><img name="" src="./images/spacer.gif" width="10" height="10" alt=""></td>
                            <td bgcolor="FFFFFF" width="145"><img name="" src="./images/spacer.gif" width="115" height="10" alt=""></td>                            
                          </tr>                         
                        </table>
                      </td>
                      $str

<!--
EOT;
    $index++;
} 
print <<<EOT
-->                                                          
                      
                      <td width="4"><img name="" src="./images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
<!--
EOT;
if (!$empty_flag) {
print <<<EOT
-->  
					

                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td width="4"><img name="" src="./images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    <tr height=20 valign="middle">
                    <td colspan=5 align="right"><!--<input type="image" onMouseOver="MM_swapImage('jf_button_add_all_to_cart','','./images/button/jf_button_add_all_to_container-over.gif',1)" onMouseOut="MM_swapImgRestore()" src="./images/button/jf_button_add_all_to_container.gif" alt="Login" name="jf_button_add_all_to_cart" width="120" height="20" border="0" id="jf_button_add_all_to_cart">-->&nbsp;</td><td width="4"></td></tr>

<!--
EOT;
} else {
print <<<EOT
-->  

					We upload our inventory on demand.<br /><br />
 
If you want to see our stock, please email to info@jansenfurniture.nl<br />
 
We will upload our inventory within 1 working day and notify you once that has been done so that you can work with the most uptodate information.

<!--
EOT;
} 
print <<<EOT
--> 

                  </table>
                  </form>
                  
                  <div><img name="" src="./images/spacer.gif" width="568" height="4" alt=""></div>    
                  
                   <table width="745" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>    
                                        
                        <table width="740" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                          <td width="30"></td>
                            <td  height="14" align="center" valign="middle" class="pageListings">{$page_show['pagelink']}</td>
                          </tr>
                        </table>
                        
                       </td>
                    </tr>                    
                  </table>                   
                  
                 <!-- </div> --> 
                  </div>
                  </div>
                
<!--
EOT;
?>-->